#ifndef __WIZ_DLL_HPP__SHANHAOBO_19800429__
#define __WIZ_DLL_HPP__SHANHAOBO_19800429__

#include "../Base/Type/WizBaseType.hpp"
#include "../Base/Type/WizBaseTypeString.hpp"
#include "../Base/WizBaseException.hpp"

namespace Wiz
{
    namespace Exception
    {
        class LoadDllFailed : public ::Wiz::Exception::Type
        {
            typedef ::Wiz::Exception::Type  tSuper;
        public:
            LoadDllFailed() : tSuper("Load DLL Failed")
            {}
        public:
        };
    } /// end of namespace Exception

    namespace DLL
    {
        class WIZ_EXPORT Type
        {
        public:
            typedef ::Wiz::Void::Ptr tHandler;
        public:
            Type() : m_Core(WIZ_NULLPTR){};
            Type(::Wiz::String::In);
            Type(::Wiz::WString::In);
            virtual ~Type();
        public:
            ::Wiz::Bool::Type Open(::Wiz::String::In InPath);
            ::Wiz::Bool::Type Open(::Wiz::WString::In InPath);
        public:
            ::Wiz::Void::Type Close();
        public:
            template<class PtrT, class NameT>
            PtrT Export(const NameT& InName) const
            {
                if (this->NotValid())
                {
                    return WIZ_NULLPTR;
                }
                return ::Wiz::Cast::Reinterpret<PtrT>(this->DoExport(InName));
            }
        public:
            ::Wiz::Bool::Type IsValid() const;
            ::Wiz::Bool::Type NotValid() const;
        protected:
            tHandler DoExport(::Wiz::String::In InName) const;
            tHandler DoExport(::Wiz::WString::In InName) const;
        protected:
            tHandler m_Core;
        };
        WIZ_DECLARE(::Wiz::DLL::Type);
    } /// end of namespace DLL
} /// end of namespace Wiz

#endif /*__WIZ_DLL_HPP__SHANHAOBO_19800429__*/
